package com.example.alibabavodossservice.vod.Image;

import com.example.alibabavodossservice.CheckTools;
import com.example.alibabavodossservice.vod.BaseUploadParameter;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;

/**
 * desc:上传图片参数
 *
 * @author xugenyin
 */
@Data
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class ImageParameter extends BaseUploadParameter {
    /**
     * 图片类型
     */
    @NotNull(message = "图片类型不能为空")
    private String imageType;
    /**
     * 图片文件扩展名
     */
    private String imageExt;

    /**
     * 检查必要参数
     *
     * @param param param
     */
    public static void checkMustParam(ImageParameter param) {
        if (CheckTools.isNullOrEmpty(param.getImageType()) ) {
            throw new IllegalArgumentException("图片类型不能为空");
        }
    }
}
